<!--
 * @Date: 2020-02-28 19:32:46
 * @LastEditors: peng qiao
 * @LastEditTime: 2020-03-21 14:46:38
 -->
<template>
  <div id="oldNewsDetails">
    <van-nav-bar title="养老资讯详情" left-arrow @click-left="onClickLeft" fixed />
    <div class="news-details">
      <p class="title-style">{{viewDetailList.subject}}</p>
      <div class="label-text">
        <p class="releaseTime">发布时间： {{viewDetailList.creationDate}}</p>
        <p class="source">来源： {{viewDetailList.neighborhoodName}}</p>
      </div>
      <div class="title-img" v-if="viewDetailList.headImage">
        <img v-lazy="viewDetailList.headImage" alt="无法显示" />
      </div>
      <div class="news-content" :class="agedContent" v-html="viewDetailList.content">{{viewDetailList.content}}</div>
    </div>
    <van-popup v-model="showLoading">
      <van-loading color="#DC4630" />
    </van-popup>
  </div>
</template>
<script>
import api from "@/controller/agedService.js";
import constant from "@/controller/constant.js";
export default {
  name: "oldNewsDetails",
  data() {
    return {
      uid: "",
      viewDetailList: {},
      agedContent: "",
      showLoading: true
    };
  },
  created() {
    this.uid = this.$route.query.id;
    this.detailsShow(this.uid);
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    // 老人档案详情
    detailsShow(val) {
      api
      .pensionInformation_v1_get(val)
      .then(res => {
        this.viewDetailList = res.datas
        this.showLoading = false
        if(this.viewDetailList.headImage) {
          this.agedContent = "has-image"
        }else {
          this.agedContent = "no-image"
        }
      })
      .catch(() => {
        this.$toast(constant.netErrMsg);
      })
    }
  }
};
</script>
<style lang="scss" scope>
@import "../../styles/newsDetails";
</style>